<?php

defined('DS') ?: define('DS', DIRECTORY_SEPARATOR);
defined('ROOT') ?: define('ROOT', dirname(__DIR__) . DS);


if(file_exists(ROOT.'.env')){
    $dotenv = new \Dotenv\Dotenv(ROOT);
    $dotenv->load();
}

$wxinfo = require  'wxinfo.php';

return [
    'settings' => [
        'displayErrorDetails' => getenv('APP_DEBUG')==='true'? true:false,
        'addContentLengthHeader' => 0,
        'app' => [
            'name' => getenv('APP_NAME'),
            'url'  => getenv('APP_URL'),
            'env'  => getenv('APP_ENV'),
        ],
        //view template path setting
        'renderer' =>[
           'template_path' =>  __DIR__ . '/../resources/views',
           'template_cache_path' => getenv("TEMPLATE_CACHE")
        ],
        //Monolog setting
        'logger' =>[
            'name' => getenv('APP_NAME'),
            'path'  => getenv("LOG_PATH"),
            'level' => \Monolog\Logger::DEBUG,

        ],
        //database settings
        'db'=>[
            'driver'    => getenv('DB_CONNECTION'),
            'host'      => getenv('DB_HOST'),
            'database'  => getenv('DB_DATABASE'),
            'username'  => getenv('DB_USERNAME'),
            'password'  => getenv('DB_PASSWORD'),
            'port'      => getenv('DB_PORT'),
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
        ],
        'cors' => null !== getenv('CORS_ALLOWED_ORIGINS') ? getenv('CORS_ALLOWED_ORIGINS') : '*',
        // jwt settings
        'jwt'  => [
            'secret' => getenv('JWT_SECRET'),
            'secure' => false,
            "header" => "Authorization",
            "regexp" => "/Token\s+(.*)$/i",
            'passthrough' => ['OPTIONS'],
            'algorithm' => 'HS256'
        ],
        "message" => [
            "url"    => getenv("SMS_URL"),
            "userid" => getenv("SMS_URSERID"),
            "pwd"    => getenv("SMS_PASSWORD")
        ],
        "file"=>[
            "file_base" => getenv("FIEL_BASE"),
            "path"      => getenv("FILE_PATH")
        ],
        'cache' => [
            'token_path' => getenv("ACCESS_TOKEN")
        ]
    ]

];